{% extends "base_admin.html" %}

{% block title %}文章列表 - {% if categoryName %}{{ categoryName|escape }}{% else %}全部{% endif %}{% endblock %}

{% block admincontent %}
<h2>文章列表 - {% if categoryName %}{{ categoryName|escape }}{% else %}全部{% endif %}</h2>
<div class="frame bloglist">
    <div class="right">
        <table width="100%" cellpadding="2" cellspacing="1" border="0">
            {% for blog in blogList %}
            <tr class="{% cycle row2,row1 %}">
                <td class="title">
                    <b>{{ blog.title|escape }}</b>
                    <br />
                    <span>{{ blog.create_date|date:"Y-m-d H:i:s" }}</span>
                </td>
                <td class="act_edit">
                    <form name="set_{{ forloop.counter }}" method="post" action="/admin?action=composeBlog" >
                        <input type="hidden" name="key" value="{{ blog.key|escape }}" />
                        <button type="submit">修改</button>
                    </form>
                </td>
                <td class="act_disp"> 
                    <form name="del_{{ forloop.counter }}" method="post" action="/admin?action=setDisplay" >
                        <input type="hidden" name="key" value="{{ blog.key|escape }}" />
                        {% if blog.display %}
                        <input type="hidden" name="display" value="false" />
                        <button type="submit">隐藏</button>
                        {% else %}
                        <input type="hidden" name="display" value="true" />
                        <button type="submit">显示</button>
                        {% endif %}
                    </form>
                </td>
                <td class="act_del">
                    <form name="del_{{ forloop.counter }}" method="post" action="/admin?action=deleteBlog" >
                        <input type="hidden" name="key" value="{{ blog.key|escape }}" />
                        <button type="submit">删除</button>
                    </form>
                </td>
            </tr>
            {% endfor %}
        </table>

        <div class="paging">
            {% if prev_datetime %} 
            <a href="/admin?action=listBlog&amp;category_name={{ category.name|escape }}&amp;upto_datetime={{ prev_datetime|escape }}">PREV</a> 
            {% else %}
            <span>PREV</span>
            {% endif %}
            |
            {% if next_datetime %} 
            <a href="/admin?action=listBlog&amp;category_name={{ category.name|escape }}&amp;upto_datetime={{ next_datetime|escape }}">NEXT</a> 
            {% else %}
            <span>NEXT</span>
            {% endif %}
        </div>
    </div>
    <div class="left">
        <div>
            <ul>
                <li>
                <a href="/admin?action=listBlog">全部</a>
                </li>
                <li>
                ----
                </li>
                {% for category in categoryList %}
                <li>
                <a href="/admin?action=listBlog&amp;category_name={{ category.name|escape }}">{{ category.name|escape }}</a>
                </li>
                {% endfor %}
            </ul>
        </div>

    </div>
</div>

{% endblock %}

